/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package simhya.matheval.function;

import cern.jet.random.engine.MersenneTwister64;
import cern.jet.random.Exponential;
import cern.jet.random.Normal;

/**
 *
 * @author Luca
 */
public class RandomGenerator {
    private static final java.util.Random randSeeder;
    private static final MersenneTwister64 rand;
    private static final Exponential exp;
    private static final Normal norm;

    static {
        randSeeder = new java.util.Random(System.currentTimeMillis());
        rand = new MersenneTwister64(randSeeder.nextInt());
        exp = new Exponential(1.0, rand);
        norm = new Normal(0.0,1.0,rand);
    }

    public static double nextUniform() {
        return rand.nextDouble();
    }

    public static double nextExponential(double lambda) {
        return exp.nextDouble(lambda);
    }

    public static double nextNormal(double mean, double stdDev) {
        return norm.nextDouble(mean, stdDev);
    }



    
}
